<% form_for(expense) do |f| %>

  <p><label for="description">Description</label><br />
  <%= f.text_field :description %></p>

  <p><label for="amount">Amount</label><br />
  <%= f.text_field :amount %></p>

  <p><label for="location">Location</label><br />
  <%= f.text_field :location %></p>

  <p><label for="note">Note</label><br />
  <%= f.text_area :note %></p>

  <p><label for="categories">Categories</label><br />
  <% @selected = @expense.categories.collect { |c| c.id.to_i } -%>
  <select name="expense[categories][]" size="5" multiple="multiple">
  	<%= options_from_collection_for_select(@categories, "id", "name", @selected) %>
  </select>

  <p><%= f.submit "Submit" %></p>

<% end %>